package com.example.lxj.LegalCase.service.impl;

import java.util.List;

import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.lxj.LegalCase.mapper.TbAgreementMapper;
import com.example.lxj.LegalCase.entity.TbAgreement;
import com.example.lxj.LegalCase.service.ITbAgreementService;

/**
 * 司法鉴定协议Service业务层处理
 * 
 * @author lxj
 * @date 2024-10-23
 */
@Service
public class TbAgreementServiceImpl implements ITbAgreementService 
{
    @Autowired
    private TbAgreementMapper tbAgreementMapper;

    /**
     * 查询司法鉴定协议
     * 
     * @param id 司法鉴定协议主键
     * @return 司法鉴定协议
     */
    @Override
    public TbAgreement selectTbAgreementById(Long id)
    {
        return tbAgreementMapper.selectTbAgreementById(id);
    }

    /**
     * 查询司法鉴定协议列表
     * 
     * @param tbAgreement 司法鉴定协议
     * @return 司法鉴定协议
     */
    @Override
    public List<TbAgreement> selectTbAgreementList(TbAgreement tbAgreement)
    {
        return tbAgreementMapper.selectTbAgreementList(tbAgreement);
    }

    /**
     * 新增司法鉴定协议
     * 
     * @param tbAgreement 司法鉴定协议
     * @return 结果
     */
    @Override
    public int insertTbAgreement(TbAgreement tbAgreement)
    {
        tbAgreement.setCreateTime(DateUtil.date());
        return tbAgreementMapper.insertTbAgreement(tbAgreement);
    }

    /**
     * 修改司法鉴定协议
     * 
     * @param tbAgreement 司法鉴定协议
     * @return 结果
     */
    @Override
    public int updateTbAgreement(TbAgreement tbAgreement)
    {
        tbAgreement.setUpdateTime(DateUtil.date());
        return tbAgreementMapper.updateTbAgreement(tbAgreement);
    }

    /**
     * 批量删除司法鉴定协议
     * 
     * @param ids 需要删除的司法鉴定协议主键
     * @return 结果
     */
    @Override
    public int deleteTbAgreementByIds(Long[] ids)
    {
        return tbAgreementMapper.deleteTbAgreementByIds(ids);
    }

    /**
     * 删除司法鉴定协议信息
     * 
     * @param id 司法鉴定协议主键
     * @return 结果
     */
    @Override
    public int deleteTbAgreementById(Long id)
    {
        return tbAgreementMapper.deleteTbAgreementById(id);
    }
}
